package com.zwan.oam_rtc.constants;

import com.zwan.oam_rtc.bean.JimpSettings;
import com.zwan.oam_rtc.bean.OamSettings;

public class Const {
  static JimpSettings jimpSettings = com.zwan.oam_rtc.utils.ApplicationContextProvider.getBean(JimpSettings.class);
  static OamSettings oamSettings = com.zwan.oam_rtc.utils.ApplicationContextProvider.getBean(OamSettings.class);


  public final static int MAX_MSG_LEN = 5400;
  public final static int MAX_MPMSG_LEN = 1400;
  public final static int MAX_PNO = 400; //pno < MAX_PNO
  public final static int MIN_PNO = 260; //pno>=MIN_PNO
  public final static int MAX_SOCKET_SERVER_NUM = 20;
  public final static int MAX_SOCKET_CLIENT_NUM = 20;
  public final static int MAX_SOCKET_NUM = MAX_SOCKET_SERVER_NUM + MAX_SOCKET_CLIENT_NUM;
  public final static int MAX_RESEND_NUM = 200;

  public final static int MAX_SERVER_NUM = 133;
  public final static int MIN_SERVER_NUM = 129;
  public final static int MAX_CLIENT_NUM = 254;
  public final static int MIN_CLIENT_NUM = 134;
  public final static int MIN_AREA_CODE = 10;
  public final static int MAX_AREA_CODE = 999;
  public final static int MAX_POST_NUM = 254;
  public final static int MAX_MP_NODE = 64;

  public final static int MAX_PENDING_CONNECTS = 8;
  public final static int MAX_MAINTAIN_POST_NUM = 32;
  public final static int MAX_RECEIVE_ERROR_NUM = 30;
  public final static int RECEIVE_BUFFER_LEN = 2048;
  public final static int NAME_LEN = 20;
  public final static int MAX_APPLICATION_WAIT_QUEUE_LEN = 100;

  public final static int R01_SUCCESS = 0;
  public final static int R01_PNO_ERROR = 3;
  public final static int R01_NAMEDTIMER_NO_DEFINE = 14;
  public final static int R01_OTHER_ERROR = 0xFF;
  public final static int BYTE8 = 0xff;
  public final static int BYTE16 = 0xffff;

  public final static int TIME_IDLE = 5 * 1000;
  public final static int TIME_REG_DTMF = 2 * 1000;
  public final static int INNER_TIME = 500;
  public final static int SEND_TO_PC = 1;
  public final static byte TCP_CHECK_TYPE = (byte) 0xFF;
  public final static int  TCP_CHECK_BODYLEN = 11;
  public final static int MSG_HEAD_LEN = 31; //byte
  public final static int MSG_BODY_0 = 30; //
  public final static int MAX_NOREPONSE_NUM = 4;
  //link-status
  public final static int LINK_SUCCESS = 0;
  public final static int LINK_FALSE = 1;
  public final static int WAIT_TO_CLOSE = 2;

  public final static short SQL_QUERY = 1;
  public final static short SQL_PROC = 2;

  public final static short SLP_PNO = 4;
  public final static short JANUS_PNO = 32;
  public final static short SCP_MODULE = jimpSettings.getWintcp().getPeerModule().shortValue();

  public final static String ParamErr  = "参数错误";

  //终端类型，见：E_PartcipationType
  public final static short partcipation_type_none = 0;
  public final static short partcipation_type_webrtc = 1;
  public final static short partcipation_type_sip_ps = 2;
  public final static short partcipation_type_sip_phone = 3;
  public final static short partcipation_type_sip_volte = 4;
  public final static short partcipation_type_file = 5;
  public final static short partcipation_type_unity = 6;

  //leg 类型
  public final static short leg_type_none = 0;
  public final static short leg_type_A = 1;  //主叫腿
  public final static short leg_type_B = 2;  //被叫腿

  public final static int EV_OAM = 50000;
  public final static int EV_OAM_TO_JANUS = EV_OAM+1;
  public final static int EV_JANUS_TO_OAM = EV_OAM+2;
  public final static int EV_JANUS_TO_OAM_SIP_MESSAGE = EV_OAM+3;    //sip消息信息
  public final static int EV_JANUS_TO_OAM_ZWMP_MESSAGE = EV_OAM+4;   //zwmp事件
  public final static int EV_JANUS_TO_OAM_ROOM_MESSAGE = EV_OAM+5;   //room状态事件
  public final static int EV_IVR_TO_JANUS = EV_OAM+6;
  public final static int EV_JANUS_TO_IVR = EV_OAM+7;

  public final static int EV_JANUS_CONNECTED_MESSAGE = EV_OAM+99;   //janus链接成功状态，oam的内部事件

  public final static short JANUS_COMMAND_SET = 8000;
  public final static short OAM_COMMAND_GET_CONF_LIST = JANUS_COMMAND_SET+1;
  public final static short OAM_COMMAND_GET_USER_LIST = JANUS_COMMAND_SET+2;
  public final static short OAM_COMMAND_GET_CONF = JANUS_COMMAND_SET+3;
  public final static short OAM_COMMAND_CONF_SMS = JANUS_COMMAND_SET+4;
  public final static short OAM_COMMAND_MRFP_LIST = JANUS_COMMAND_SET+5;
  public final static short OAM_COMMAND_MRFP_DETAIL = JANUS_COMMAND_SET+6;
  public final static short OAM_COMMAND_MRFP_DETAIL_RES = JANUS_COMMAND_SET+7;
  public final static short OAM_COMMAND_QUERY_DEVICE = JANUS_COMMAND_SET+8;
  public final static short OAM_COMMAND_RECORD_START = JANUS_COMMAND_SET+9;
  public final static short OAM_COMMAND_RECORD_STOP = JANUS_COMMAND_SET+10;
  public final static short OAM_COMMAND_RECORD_SWITCH = JANUS_COMMAND_SET+11;
  public final static short OAM_COMMAND_RECORD_SNAP = JANUS_COMMAND_SET+12;
  public final static short OAM_COMMAND_REGISTER_OBSERVER = JANUS_COMMAND_SET+13;
  public final static short OAM_COMMAND_SIP_MESSAGE = JANUS_COMMAND_SET+14;
  public final static short OAM_COMMAND_SIP_SUBSCRIBE = JANUS_COMMAND_SET+15;
  public final static short OAM_COMMAND_QUERY_QOS = JANUS_COMMAND_SET+16;
  public final static short OAM_COMMAND_QUERY_ZWMP_USAGE = JANUS_COMMAND_SET+17;
  public final static short OAM_COMMAND_QUERY_ZWMP_PORT = JANUS_COMMAND_SET+18;
  public final static short OAM_COMMAND_QUERY_ZWMP_CHANS = JANUS_COMMAND_SET+19;
  public final static short OAM_COMMAND_QUERY_ZWMP_CHAN_DETAIL = JANUS_COMMAND_SET+20;
  public final static short OAM_COMMAND_INVITE_SIP = JANUS_COMMAND_SET+21;
  public final static short OAM_COMMAND_CREATE_ROOM = JANUS_COMMAND_SET+22;
  public final static short OAM_COMMAND_DELETE_ROOM = JANUS_COMMAND_SET+23;
  public final static short OAM_COMMAND_REGISTER_ROOM_OBSERVER = JANUS_COMMAND_SET+24;
  public final static short OAM_COMMAND_REGISTER_IVR_CONTROLLER = JANUS_COMMAND_SET+25;
  
  // BCSM：媒体服务器->IVR，  REQ: IVR->媒体服务器 
  public final static short OAM_COMMAND_IVR_CALL_BCSM = JANUS_COMMAND_SET+26;
  public final static short OAM_COMMAND_IVR_CALL_REQ = JANUS_COMMAND_SET+27;
  public final static short OAM_COMMAND_IVR_ACTIVE_BCSM = JANUS_COMMAND_SET+28;
  public final static short OAM_COMMAND_IVR_PAC_REQ = JANUS_COMMAND_SET+29;
  public final static short OAM_COMMAND_IVR_PAC_BCSM = JANUS_COMMAND_SET+30;
  public final static short OAM_COMMAND_IVR_ROUTE_REQ = JANUS_COMMAND_SET+31;
  public final static short OAM_COMMAND_IVR_ROUTE_BCSM = JANUS_COMMAND_SET+32;
  public final static short OAM_COMMAND_IVR_DTMF_BCSM = JANUS_COMMAND_SET+33;
  public final static short OAM_COMMAND_IVR_TERMINATE_REQ = JANUS_COMMAND_SET+34;  
  public final static short OAM_COMMAND_IVR_TERMINATE_BCSM = JANUS_COMMAND_SET+35;  
  public final static short OAM_COMMAND_GET_CONF_LIST_BRIEF = JANUS_COMMAND_SET+36;
  public final static short OAM_COMMAND_FORWARD_CALL_OUT_REQ = JANUS_COMMAND_SET+37;
  public final static short OAM_COMMAND_FORWARD_CALL_OUT_BCSM = JANUS_COMMAND_SET+38;
  public final static short OAM_COMMAND_COMPOSITE_REQ = JANUS_COMMAND_SET+39;
  public final static short OAM_COMMAND_IVR_CANCEL_ROUTE_REQ = JANUS_COMMAND_SET+40;  //停止路由到坐席
}
